''========================================================
'' Autor: 		Luis Antonio Lara Capetillo
'' Fecha Creación: 	24/9/2012
'' Descripcion: 	Clase Componente ctlGrid
''========================================================

Public Class ctlGrid

	  Public Event btnnid Clicked As EventHandler
	  Public Event btnnid Clicked As EventHandler
	  Public Event btnnid Clicked As EventHandler
	  Public Event btnnidSelected As EventHandler
      Public Event btnnidPage As GridViewPageEventHandler

#Region "Propiedades"

  ''' <summary>
  ''' Habilita o Desabilita el Control para Edicion
  ''' </summary>
  ''' <value>True o False</value>
  ''' <remarks></remarks>
  Public WriteOnly Property Enabled() As Boolean
    Set(value As Boolean)
	  btnnid.Enabled=value
      btnnid.Enabled=value
      btnnid.Enabled=value
      btnnid.Enabled=value
      
    End Set
  End Property

  ''' <summary>
  ''' Habilita o Desabilita el Control para solo lectura
  ''' </summary>
  ''' <value>True o False</value>
  ''' <remarks>ReadOnly</remarks>
  Public WriteOnly Property Lectura() As Boolean
    Set(value As Boolean)
	  btnnid.ReadOnly=value
      btnnid.ReadOnly=value
      btnnid.ReadOnly=value
      btnnid.ReadOnly=value
      
    End Set
  End Property


#End Region
#Region "Eventos"
  Protected Sub btnnid_Click(sender As Object, e As System.EventArgs) Handles btnnid.Click
    OnbtnnidClick(sender)
  End Sub

  Protected Sub btnnid_Click(sender As Object, e As System.EventArgs) Handles btnnid.Click
    OnbtnnidClick(sender)
  End Sub

  Protected Sub btnnid_Click(sender As Object, e As System.EventArgs) Handles btnnid.Click
    OnbtnnidClick(sender)
  End Sub

  ''' <summary>
  ''' Evento que se genera cuando se selecciona un objeto del btnnid
  ''' </summary>
  ''' <param name="sender"> es un Object</param>
  ''' <param name="e"> es de tipo EventArgs</param>
  ''' <remarks></remarks>
  Protected Sub btnnid_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles btnnid.SelectedIndexChanged
    OngvDatosClick(sender)
  End Sub
  ''' <summary>
  ''' Evento que se genera cuando se selecciona una pagina del btnnid
  ''' </summary>
  ''' <param name="sender"> es un Object</param>
  ''' <param name="e"> es de tipo GridViewPageEventArgs</param>
  ''' <remarks></remarks>
  Protected Sub btnnid_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles btnnid.PageIndexChanging
    OngvSelectionPage(sender, e.NewPageIndex)
  End Sub

#End Region
#Region "Metodos"
  Protected Overridable Sub OnbtnnidClick(ByVal sender As Object)
    RaiseEvent btnnidClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidClick(ByVal sender As Object)
    RaiseEvent btnnidClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidClick(ByVal sender As Object)
    RaiseEvent btnnidClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidClick(ByVal sender As Object)
    RaiseEvent btnnidSelected(sender, New EventArgs)
  End Sub
  Protected Overridable Sub OnbtnnidSelectionPage(sender As Object, ByVal index As Integer)
    RaiseEvent btnnidPage(sender, New GridViewPageEventArgs(index))
  End Sub

  ''' <summary>
  ''' Metodo para asignar los datos al componente ctlTurismo
  ''' </summary>
  ''' <param name="tablaDatos">DataTable donde se obtienen los datos</param>
  ''' <remarks></remarks>
  Public Sub AsignarDatos(ByVal tablaDatos As DataTable)
    
  End Sub

  ''' <summary>
  ''' Metodo para llenar el btnnid con datos de la table
  ''' </summary>
  ''' <param name="tabla">tabla donde se obtienen los datos</param>
  ''' <remarks></remarks>
  Public Sub llenarbtnnid(ByVal tabla As DataTable)
    Me.gvDatos.DataSource = tabla
    Me.gvDatos.DataBind()
  End Sub
  ''' <summary>
  ''' Metodo para Seleccionar la pagina de el btnnid
  ''' </summary>
  ''' <param name="e">es un evento de tipo GridViewPageEventArgs</param>
  ''' <remarks></remarks>
  Public Sub SelecPagebtnnid(ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs)
    Me.btnnid.PageIndex = e.NewPageIndex
    Me.btnnid.DataBind()
  End Sub


#End Region
End Class
